<%@page import="edu.hcmus.sow.utils.StringUtil"%>
<%@ page language="java" isELIgnored="false" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>

<%@page import="javax.swing.text.DateFormatter"%>
<%@page import="java.text.DateFormat"%>
<%@page import="java.util.Date"%>
<%@page import="org.ocpsoft.pretty.time.PrettyTime"%>
<jsp:directive.include file="/WEB-INF/sitemesh-decorators/include.jsp" />


<c:forEach items="${completeTasks }" var="compTask" varStatus="i">
	<li class="completedtask" ><span>
		<div class="task taskData">
			<div style="visibility: hidden;" class="toolbar_left">
				<a class="action taskcross" href="#">move <img
					src="${pageContext.request.contextPath}/images/task-move-icon.png"></a>
			</div>
			<span class="spinnerContainer" style="display: none;"
				id="spinnerContainer72">&nbsp;<img
				src="${pageContext.request.contextPath}/images/throbber.gif"></span>
			
			<div class="fixed task_infos" style="width: 500px;">
				
				<c:set var="createdDate" value="${compTask.createdDate.getTime()}"></c:set>
						<span style="text-align:right; font-style:italic; color: gray;">Updated&nbsp;<%=new PrettyTime().format((Date) pageContext.getAttribute("createdDate"))%></span> by&nbsp; ${compTask.userByCreatedBy.username}
				<a style="position: static; " class="link comments" href="${pageContext.request.contextPath}/task/${compTask.id}/view">
					<c:if test="${commentsCompleted.get(i.count -1) == null }">
						<span class="">0</span>
					</c:if>
					<c:if test="${commentsCompleted.get(i.count -1) != null }">
						<span class="">${commentsCompleted.get(i.count -1)}</span>
					</c:if>
				</a>
						 <span class="author"> </span>
				<div class="indicators">
					<div class="progress" title="Progress">
						<div class="mask"></div>
						<div class="status" style="width: ${coompTask.adjustedEstimate}%;"></div>
					</div>
					<div class="est" title="Estimated time">
						<div class="mask"></div>
						<div class="status" style="display: none;"></div>
					</div>
				</div>
			</div>
			<div class="fluid">
	
				&nbsp; 
				<a href="${pageContext.request.contextPath}/task/${compTask.id}/view">
				<c:set var="content" value="${compTask.title}"></c:set> 
					<span class="task completedTask">
						<%=StringUtil.subStringToDisplay((String)(pageContext.getAttribute("content")), 50) %>
					</span>
				</a>
				<span style="margin-left: 10px;" class="cubeLink">
					[<a href="${pageContext.request.contextPath}/project/${compTask.project.id}/view" style="margin-left:2px; margin-right:2px; font-style: italic; color: gray;">
						${compTask.project.name }
					</a>]
				</span>
	
			</div>
		</div>
	
		<div class="editPanel"	style="display: none; position: relative; height: 50px"	id="addTaskPanel67">
			<div class="task">
				<form id="taskForm76" method="post"
					action="">
					<div
						style="width: 0px; height: 0px; position: absolute; left: -100px; top: -100px; overflow: hidden">
						<input name="taskForm76_hf_0" id="taskForm76_hf_0"
							type="hidden">
					</div>
					<input class="Text" name="title" type="text"> <a
						class="gcSubmit small" id="submitLink77" href="#"
						onclick="">
						Add sub-task <span class="left"></span> <span class="right"></span>
					</a> or <a href="#" id="finishedLink66"
						onclick="">finished</a>
					<span style="display: none" id="spinnerContainer78">&nbsp;<img
						src="${pageContext.request.contextPath}/images/throbber.gif"></span>
				</form>
				<span> </span>
			</div>
		</div>
		<div class="spacer">&nbsp;</div>
	</span></li>	
</c:forEach>